////////////////////////////////////////////////////////////////////////////////
// Filename: positiontextureshader.hpp
////////////////////////////////////////////////////////////////////////////////
#ifndef POSITION_TEXTURE_SHADER_HPP_
#define POSITION_TEXTURE_SHADER_HPP_

//////////////
// INCLUDES //
//////////////
#include <d3d11.h>
#include <D3DX10math.h>
#include <D3DX11async.h>
#include <fstream>

/////////////////////////////////////////////////////////////////////////////////
// Class name: PositionTextureShader
/////////////////////////////////////////////////////////////////////////////////
class PositionTextureShader {
private:
	struct MatrixBufferType {
		D3DXMATRIX world;
		D3DXMATRIX view;
		D3DXMATRIX projection;
	};

public:
	PositionTextureShader();
	~PositionTextureShader();

	bool Initialize(ID3D11Device* device, HWND hWnd);
	void Shutdown();
	bool Render(ID3D11DeviceContext* deviceContext, int indexCount, D3DXMATRIX world, D3DXMATRIX view, D3DXMATRIX projection, ID3D11ShaderResourceView* texture);

private:
	bool InitializeShader(ID3D11Device* device, HWND hWnd, WCHAR* vsFilename, WCHAR* psFilename);
	void ShutdownShader();
	void OuputShaderErrorMessage(ID3D10Blob* errorMessage, HWND hWnd, WCHAR* filename);

	bool SetShaderParameters(ID3D11DeviceContext* deviceContext, D3DXMATRIX worldMatrix, D3DXMATRIX viewMatrix, D3DXMATRIX projectionMatrix, ID3D11ShaderResourceView* texture);
	void RenderShader(ID3D11DeviceContext* deviceContext, int indexCount);

private:
	ID3D11VertexShader* m_vertexShader;
	ID3D11PixelShader* m_pixelShader;
	ID3D11InputLayout* m_layout;
	ID3D11Buffer* m_matrixBuffer;
	ID3D11SamplerState* m_sampleState;
};

#endif
